# 以正确的宽度在居中的“盒子”内打印一个句子
# 注意，整数除法运算符（//） 只能在Python2.2

sentence = input("Sentence: ")
# for debug
# sentence = "He's a very naughty boy!"

text_width = len(sentence)
# 盒子宽度是输入长度+6
box_width = text_width + 6
# 显示长度是盒子长度+20
left_margin = (box_width + 20) // 2

print()
print('+' + '-' * (box_width + 2 * left_margin - 2) + '+')
print(' ' * left_margin + '|' + ' ' * text_width + '|')
print(' ' * left_margin + '|' + sentence + '|')
print(' ' * left_margin + '|' + ' ' * text_width + '|')
print('+' + '-' * (box_width + 2 * left_margin - 2) + '+')
print()
